import sys
sys.path.append("../")
from codes.WaterSphere import *
import unittest

class WaterSphereTest(unittest.TestCase):
    """
    测试WaterSphere模块
    """

    def test_cal_normal_angle(self):
        """
        测试normalAngle方法的准确性
        """
        ws = WaterSphere(radius=1)
        normalAngle1 = ws.calNormalAngle([1/2**0/5,1/2**0/5])
        normalAngle2 = ws.calNormalAngle([-1/2**0/5,1/2**0/5])
        self.assertAlmostEqual(45, normalAngle1, delta=0.1)
        self.assertAlmostEqual(-45, normalAngle2, delta=0.1)

if __name__ == "__main__":
    unittest.main(verbosity=2)
